package com.ywjt.platformbusiness.widget;

import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.base.BaseBottomDialog;
import com.ywjt.platformbusiness.market.commongoods.adapter.BottomCouponAdapter;
import com.ywjt.platformbusiness.market.commongoods.model.GoodsDetail;
import com.ywjt.platformbusiness.my.adapter.CouponAdapter;

import java.util.List;

public class CouponPickBottomDialog extends BaseBottomDialog {
    private RecyclerView rcCommon;
    private BottomCouponAdapter adapter;
    private Context mContext;
    private ImageView ivClose;
    private  List<GoodsDetail.ResultDTO.DiscountCouponListDTO> couponListDTOS;

    private ClickListenerInterface clickListenerInterface;

    public interface ClickListenerInterface {

    }

    public CouponPickBottomDialog(Context context,List<GoodsDetail.ResultDTO.DiscountCouponListDTO> couponListDTOS) {
        this.mContext=context;
        this.couponListDTOS=couponListDTOS;
    }

    @Override
    public int getLayoutRes() {
        return R.layout.bottom_coupon_pick;
    }

    @Override
    public void bindView(View v) {
        rcCommon=v.findViewById(R.id.rcCommon);
        ivClose=v.findViewById(R.id.ivClose);

        if (couponListDTOS!=null&&couponListDTOS.size()>0){
            adapter=new BottomCouponAdapter(couponListDTOS,0);
            rcCommon.setAdapter(adapter);
            rcCommon.setLayoutManager(new LinearLayoutManager(mContext));
        }
        ivClose.setOnClickListener(new clickListener());
    }

    public void setClicklistener(ClickListenerInterface clickListener) {
        clickListenerInterface = clickListener;
    }

    private class clickListener implements View.OnClickListener {

        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.ivClose:
                    dismiss();
                    break;
            }
        }
    }
}
